<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title th:text="${application.project.projectName}"></title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script th:src="@{/plugin/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        // 是否开启刷新记忆tab功能
        var is_remember = false;
    </script>
</head>
<body class="index">
<!-- 顶部开始 -->
<div class="container">
    <div class="logo">
        <a href="#" th:text="${application.project.projectName}"></a></div>
    <div class="left_open">
        <a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
    </div>

    <ul class="layui-nav right" lay-filter="">
        <li class="layui-nav-item">
            <a href="javascript:;" id="carTrace">车辆地图追踪</a>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:;" th:text="${session.sessionUser.sysUser.name}"></a>
            <dl class="layui-nav-child">
                <dd><a href="#" onclick="doLogout()">注销</a></dd>
            </dl>
        </li>
    </ul>
</div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<!-- 左侧菜单开始 -->
<div class="left-nav">
    <div id="side-nav">
        <ul id="nav">
        </ul>
    </div>
</div>
<!-- <div class="x-slide_left"></div> -->
<!-- 左侧菜单结束 -->
<!-- 右侧主体开始 -->
<div class="page-content">
    <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
        <ul class="layui-tab-title">
            <li class="home" lay-id="home">
                <i class="layui-icon">&#xe68e;</i>主页</li></ul>
        <div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">
            <dl>
                <dd data-type="refresh">刷新</dd>
                <dd data-type="this">关闭当前</dd>
                <dd data-type="other">关闭其它</dd>
                <dd data-type="all">关闭全部</dd></dl>
        </div>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <iframe th:src='@{/welcome.html}' frameborder="0" scrolling="yes" class="x-iframe" tab-id="home"></iframe>
            </div>
        </div>
        <div id="tab_show"></div>
    </div>
</div>
<div class="page-content-bg"></div>
<style id="theme_style"></style>
<!-- 右侧主体结束 -->
<!-- 中部结束 -->
<!-- 底部开始 -->
<div class="footer">
    <div class="copyright" th:text="${application.project.devCompanyName}"></div>
</div>
<!-- 底部结束 -->
<script type="text/javascript">
    var ctx = '[[${#httpServletRequest.getContextPath()}]]';
</script>
<script type="text/javascript">
    layui.use(['element','layer'], function(){
        var element = layui.element;
        var $ = layui.jquery;
        var layer = layui.layer;

        createSysMenu();

        // 生成菜单
        function createSysMenu(){
            $.ajax({
                url:ctx+"/rbac/acl/sysMenu",
                type:"get",
                dataType:"json",
                data:{},
                success:function(res){
                    var data = res.data;
                    var liStr= "";
                    // 遍历生成主菜单
                    for( var i = 0; i <data.length; i++){
                        liStr += "<li><a href='javascript:;'><i class='iconfont layui-icon left-nav-li "+data[i].icon+"' lay-tips='"+data[i].name+"'></i><cite>"+data[i].name+"</cite><i class='iconfont nav_right'>&#xe697;</i></a>";
                        if(data[i].children.length > 0){
                            liStr += "<ul class=\"sub-menu\">";
                            for(var j = 0; j <data[i].children.length; j++){
                                var temp = data[i].children[j];
                                liStr += "<li> <a onclick=\"xadmin.add_tab('"+temp.name+"','"+temp.url+"')\"><i class='iconfont layui-icon "+temp.icon+"'></i><cite>"+temp.name+"</cite></a></li>";
                            }
                            liStr += "</ul></li>";
                        }
                    };

                    //liStr += "</li>";
                    $("#nav").html(liStr);
                    element.init();
                }
            });
        }


        // 车辆信息追踪
        $('#carTrace').click(function(){
            layer.confirm('友情提示:是否打开车辆追踪系统?', {icon: 3, title:'提示'}, function(index){
                window.open("http://121.42.164.169:89/mygpsonline/");
                layer.close(index);
            });
        });
    });

    // 注销
    function doLogout(){
        layer.confirm('你确定要注销吗?', {icon: 3, title:'提示'}, function(index){
            $.ajax({
                url: ctx + "/rbac/logout",
                success: function (res) {
                    if(res.success){
                        layer.close(index);
                        window.location.href = ctx + "/";
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });

        });

    }
</script>
</body>

</html>